package com.bstek.urule.console.servlet.decisiontable;

import com.bstek.urule.console.servlet.base.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 *
 * </p>
 *
 * @author zhouchaoliang
 * @since 2021/12/9
 */
@Controller
public class DecisiontableEditorController extends BaseController {

    @GetMapping("/urule/decisiontableeditor")
    public ModelAndView decisiontable(HttpServletRequest req, HttpServletResponse resp) {
        ModelAndView mv = new ModelAndView("/decisiontable-editor");
        mv.addObject("contextPath", req.getContextPath());
        String file = req.getParameter("file");
        String project = buildProjectNameFromFile(file);
        if (project != null) {
            mv.addObject("project", project);
        }
        return mv;
    }
}
